//
//  HMComposeButton.swift
//  WeiBoSwift
//
//  Created by hgj on 2016/11/21.
//  Copyright © 2016年 HuGuoJian. All rights reserved.
//

import UIKit

let composeBtnWidth: CGFloat = 80
let composeBtnHeight: CGFloat = 110

class HMComposeButton: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        // 设置
        titleLabel?.textAlignment = .center
        titleLabel?.font = UIFont.systemFont(ofSize: 14)
        setTitleColor(UIColor.darkGray, for: .normal)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    // 布局 titleLabel
    override func titleRect(forContentRect contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: composeBtnWidth, width: composeBtnWidth, height: composeBtnHeight - composeBtnWidth)
    }
    
    // 布局imageView
    override func imageRect(forContentRect contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: 0, width: composeBtnWidth, height: composeBtnWidth)
    }
}
